<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title>Login Page | Amaze UI Example</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
  <style>
    .header {
      text-align: center;
    }
    .header h1 {
      font-size: 200%;
      color: #333;
      margin-top: 30px;
    }
    .header p {
      font-size: 14px;
    }
  </style>
</head>
<body>
<div class="header">
  <div class="am-g">
    <h1>京唐国际客户关系管理系统</h1>
    <p>JingTangGuoJi<br/>客户至上&nbsp;&nbsp;&nbsp;&nbsp;服务至诚</p>
  </div>
  <hr />
</div>
<div class="am-g">
  <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
    <h3 style="text-align: center;">用户登录</h3>
    <hr>
	<div class="am-alert am-alert-success" id="errorMsg"
				style="display: none;">
				<button type="button" class="am-close">&times;</button>
				<p></p>
			</div>
    <form method="post" class="am-form" id="form">
      <label for="username">用户名:</label>
      <input type="text" name="username" id="username" value="">
      <br>
      <label for="password">密码:</label>
      <input type="password" name="password" id="password" value="">
      <div>登录用程序员用户：test	密码：test </div>
      <br>
      <div class="am-cf" style="text-align: center;">
	      <a id="btnLogin" class="am-btn am-btn-primary am-btn-sm am-fl">登 录</a>
	      <label for="remember-me">
	        <input id="remember-me" type="checkbox">
	       		 记住密码
	      </label>
      </div>
    </form>
    <hr>
    <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
  </div>
</div>
 <% include("/common/inc/_js.html"){} %>
<script type="text/javascript">
	$(function() {
		//设置
		$("#btnLogin").click(function() {
			login();
		})
		
		//键盘按下事件	回车(登录)
		$("#form").keydown(function(e) {
			if(e.keyCode==13){
				login();
			}
		});
	})
	function login(){
		alert="";
		//获取用户名
		var username = $("#username").val();
		var password = $("#password").val();
		$.ajax({
			url : "login",
			type : "post",
			data : {
				"username" : username,
				"password" : password
			},
			success : function(data) {
				if (data.errorCode != "0") {
					$('#errorMsg p').html(data.errorMsg);
					$('#errorMsg').alert();
					$('#errorMsg').show();
					return;
				}
				location.href = "${ctxPath}${servletPath}";
			}
		})
	}
</script>
</body>
</html>
